using System;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Windows.Data;
using SExperiment;
using SExperiment.ExperimentResult;

namespace Converters
{
	public class ConclusionConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value != DependencyProperty.UnsetValue && value is SampleTargetItem)
			{
				StringBuilder stringBuilder = new StringBuilder();
				SampleTargetItem sampleTargetItem = (SampleTargetItem)value;
				foreach (Conclusion conclusion in sampleTargetItem.Result.ConclusionList)
				{
					stringBuilder.Append(conclusion.Content);
				}
				return stringBuilder.ToString();
			}
			return "";
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value;
		}
	}
}
